import * as step from '@flow-step/step-toolkit'

export async function installGolangciLint(version: string): Promise<string> {
    const toolName: string = 'golangci-lint'
    step.info(`Try to install golangci-lint with version ${version}`)

    try {
        // 使用 step.tool.install 安装指定版本
        return await step.tool.install(toolName, version)
    } catch (err) {
        throw new Error(`Failed to install golangci-lint ${version}: ${err}`)
    }
}
